package org.huatek.anders.service;

import com.alibaba.dubbo.config.annotation.Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author anders
 * @date 2018-11-15 13:50
 * TopicExchange 交互器
 **/
@Service
@Slf4j
public class ApiPaymentSenderServiceImpl implements ApiPaymentSenderService {
    private final RabbitTemplate rabbitTemplate;
    @Autowired
    public ApiPaymentSenderServiceImpl(RabbitTemplate rabbitTemplate){
        this.rabbitTemplate = rabbitTemplate;
    }

    @Override
    public void order(String msg){
        log.info("api.payment.order send message: "+msg);
        rabbitTemplate.convertAndSend("paymentExchange", "api.payment.order", msg);
    }
    @Override
    public void orderQuery(String msg){
        log.info("api.payment.order.query send message: "+msg);
        rabbitTemplate.convertAndSend("paymentExchange", "api.payment.order.query", msg);
    }
    @Override
    public void orderDetailQuery(String msg){
        log.info("api.payment.order.detail.query send message: "+msg);
        rabbitTemplate.convertAndSend("paymentExchange", "api.payment.order.detail.query", msg);
    }
}
